package com.leyou.auth.utils;

import com.leyou.auth.dto.UserDetail;

/**
 * @author ：qcq
 * @date ：Created in 2020/12/19 11:45
 * @description：
 */
public class UserContext {
    private static final ThreadLocal<UserDetail> threadLocal = new ThreadLocal<UserDetail>();

    public static void setUser(UserDetail user) {
        threadLocal.set(user);
    }

    public static UserDetail getUser() {
        return threadLocal.get();
    }

    public static void removeUser() {
        threadLocal.remove();
    }

}
